package com.xiangban.service.fallback;

import com.xiangban.model.dto.SmsParameterDto;
import com.xiangban.model.res.ApiResult;
import com.xiangban.service.fegin.SmsServiceFeign;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class SmsServiceFallback implements FallbackFactory<SmsServiceFeign> {

    public SmsServiceFeign create(Throwable throwable) {
        return new SmsServiceFeign() {
            @Override
            public ApiResult<Object> sendSms(SmsParameterDto smsParameterDto) {
                return ApiResult.newError("验证码获取失败");
            }

        };
    }
}
